home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / MoreFiles 1.2.1 / FileCopy.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  5.4 KB  |  161 lines  |  [TEXT/KAHL]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    FileCopy: A robust, general purpose file copy routine.
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support
  7. **
  8. **    File:        FileCopy.h
  9. **
  10. **    Copyright © 1992-1994 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __FILECOPY__
  23. #define __FILECOPY__
  24.  
  25. #ifndef __TYPES__
  26. #include <Types.h>
  27. #endif
  28.  
  29. #ifndef __ERRORS__
  30. #include <Errors.h>
  31. #endif
  32.  
  33. #ifndef __MEMORY__
  34. #include <Memory.h>
  35. #endif
  36.  
  37. #ifndef __OSUTILS__
  38. #include <OSUtils.h>
  39. #endif
  40.  
  41. #ifndef __FILES__
  42. #include <Files.h>
  43. #endif
  44.  
  45. #ifndef __MOREFILES__
  46. #include "MoreFiles.h"
  47. #endif
  48.  
  49. #ifndef __MOREFILESEXTRAS__
  50. #include "MoreFilesExtras.h"
  51. #endif
  52.  
  53. #include "MoreDesktopMgr.h"
  54.  
  55.  
  56. /*****************************************************************************/
  57.  
  58. pascal    OSErr    FileCopy(short srcVRefNum,
  59.                          long srcDirID,
  60.                          ConstStr255Param srcName,
  61.                          short dstVRefNum,
  62.                          long dstDirID,
  63.                          StringPtr dstPathname,
  64.                          StringPtr copyName,
  65.                          Ptr copyBufferPtr,
  66.                          long copyBufferSize,
  67.                          Boolean preflight);
  68. /*    ¶ Duplicate a file and optionally rename it.
  69.     The FileCopy function duplicates a file and optionally renames it.
  70.     Since the PBHCopyFile routine is only available on some
  71.     AFP server volumes under specific conditions, this routine
  72.     either uses PBHCopyFile, or does all of the work PBHCopyFile
  73.     does.  The srcVRefNum, srcDirID and srcName are used to
  74.     determine the location of the file to copy.  The dstVRefNum
  75.     dstDirID and dstPathname are used to determine the location of
  76.     the destination directory.  If copyName <> NIL, then it points
  77.     to the name of the new file.  If copyBufferPtr <> NIL, it
  78.     points to a buffer of copyBufferSize that is used to copy
  79.     the file's data.  The larger the supplied buffer, the
  80.     faster the copy.  If copyBufferPtr = NIL, then this routine
  81.     allocates a buffer in the application heap. If you pass a
  82.     copy buffer to this routine, make its size a multiple of 512
  83.     ($200) bytes for optimum performance.
  84.     
  85.     srcVRefNum        input:    Source volume specification.
  86.     srcDirID        input:    Source directory ID.
  87.     srcName            input:    Source file name.
  88.     dstVRefNum        input:    Destination volume specification.
  89.     dstDirID        input:    Destination directory ID.
  90.     dstPathname        input:    Pointer to destination directory name, or
  91.                             nil when dstDirID specifies a directory.
  92.     copyName        input:    Points to the new file name if the file is
  93.                             to be renamed or nil if the file isn't to
  94.                             be renamed.
  95.     copyBufferPtr    input:    Points to a buffer of copyBufferSize that
  96.                             is used the i/o buffer for the copy or
  97.                             nil if you want FileCopy to allocate its
  98.                             own buffer in the application heap.
  99.     copyBufferSize    input:    The size of the buffer pointed to
  100.                             by copyBufferPtr.
  101.     preflight        input:    If true, FileCopy makes sure there are enough
  102.                             allocation blocks on the destination volume to
  103.                             hold both the data and resource forks before
  104.                             starting the copy.
  105.  
  106.     __________
  107.     
  108.     Also see:    FSpFileCopy, DirectoryCopy, FSpDirectoryCopy
  109. */
  110.  
  111. /*****************************************************************************/
  112.  
  113. pascal    OSErr    FSpFileCopy(const FSSpec *srcSpec,
  114.                             const FSSpec *dstSpec,
  115.                             StringPtr copyName,
  116.                             Ptr copyBufferPtr,
  117.                             long copyBufferSize,
  118.                             Boolean preflight);
  119. /*    ¶ Duplicate a file and optionally rename it.
  120.     The FSpFileCopy function duplicates a file and optionally renames it.
  121.     Since the PBHCopyFile routine is only available on some
  122.     AFP server volumes under specific conditions, this routine
  123.     either uses PBHCopyFile, or does all of the work PBHCopyFile
  124.     does.  The srcSpec is used to
  125.     determine the location of the file to copy.  The dstSpec is
  126.     used to determine the location of the
  127.     destination directory.  If copyName <> NIL, then it points
  128.     to the name of the new file.  If copyBufferPtr <> NIL, it
  129.     points to a buffer of copyBufferSize that is used to copy
  130.     the file's data.  The larger the supplied buffer, the
  131.     faster the copy.  If copyBufferPtr = NIL, then this routine
  132.     allocates a buffer in the application heap. If you pass a
  133.     copy buffer to this routine, make its size a multiple of 512
  134.     ($200) bytes for optimum performance.
  135.     
  136.     srcSpec            input:    An FSSpec record specifying the source file.
  137.     dstSpec            input:    An FSSpec record specifying the destination
  138.                             directory.
  139.     copyName        input:    Points to the new file name if the file is
  140.                             to be renamed or nil if the file isn't to
  141.                             be renamed.
  142.     copyBufferPtr    input:    Points to a buffer of copyBufferSize that
  143.                             is used the i/o buffer for the copy or
  144.                             nil if you want FileCopy to allocate its
  145.                             own buffer in the application heap.
  146.     copyBufferSize    input:    The size of the buffer pointed to
  147.                             by copyBufferPtr.
  148.     preflight        input:    If true, FSpFileCopy makes sure there are
  149.                             enough allocation blocks on the destination
  150.                             volume to hold both the data and resource forks
  151.                             before starting the copy.
  152.  
  153.     __________
  154.     
  155.     Also see:    FileCopy, DirectoryCopy, FSpDirectoryCopy
  156. */
  157.  
  158. /*****************************************************************************/
  159.  
  160. #endif
  161.